package com.jy.admin.db.dao.impl;

import com.fqgj.common.base.AbstractBaseMapper;
import com.jy.admin.auth.vo.Account;
import com.jy.admin.auth.vo.MerchantCode;
import com.jy.admin.auth.vo.Password;
import com.jy.admin.db.dao.AdminDao;
import com.jy.admin.db.entity.AdminEntity;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.Map;

/**
 * User: anonymous
 * Date: 2021-10-25
 * Time: 18:00:02.727
 */

@Repository
public class AdminDaoImpl extends AbstractBaseMapper<AdminEntity> implements AdminDao {

    @Override
    public AdminEntity select(Account account) {
        Map<String, String> params = new HashMap<>();
        params.put("account", account.getVaule());
        return getSqlSession().selectOne(this.getStatement("selectOneByAccount"), params);
    }

    @Override
    public AdminEntity select(Password password) {
        Map<String, String> params = new HashMap<>();
        params.put("password", password.getValue());
        return getSqlSession().selectOne(this.getStatement("selectOneByPwd"), params);
    }

    @Override
    public AdminEntity select(MerchantCode code) {
        Map<String, String> params = new HashMap<>();
        params.put("code", code.getValue());
        return getSqlSession().selectOne(this.getStatement("selectOnByMerchantCode"), params);
    }
}